<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="<c:url value="/css/themes/default/easyui.css"/>">
<link rel="stylesheet" type="text/css" href="<c:url value="/css/themes/icon.css"/>">
<link rel="stylesheet" type="text/css" href="<c:url value="/css/themes/yzr_style.css"/>">

<script type="text/javascript" src="<c:url value="/js/jquery.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="/js/jquery.easyui.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="/js/easyui-lang-zh_CN.js"/>"></script>
<title>药品提领</title>
</head>
<body>
<script src="<c:url value="/js/jquery-migrate-1.1.0.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="/js/jquery.jqprint-0.3.js"/>"></script>
<style>
 *{
 	padding:0px;
 	margin:0px;
 }
</style>

<script type="text/javascript">
	$(function(){
		//获取当前登录用户的id
		var  drawZdr_staffId = $("#tontyiStaffId").html();
		/* 打开窗口 */
		$("#yzr-addMedDraw-med-btn").linkbutton({onClick: function(){			
			var yzr_addMedDraw_stored = $("#yzr-addMedDraw-stored").combogrid("getValue");
			if(yzr_addMedDraw_stored == ''){
				$.messager.alert("提示", "请选择仓库！");
			}else{
				$("#yzr-selectMed-medDraw-window").window("open");
				$("#tb-medDraw-selectMed").datagrid({
		    		url: 'queryMedByStore_yzr', 
		    		queryParams: {
		    			cangku: yzr_addMedDraw_stored
		    		},
		    		method: 'get'
		    	});
				$("#yzr-addMedDraw-zdr").combogrid("setValue",drawZdr_staffId);
			} 
		}});
		
		
		//显示全部
		$("#yzr-selectMed-medDraw-reload").linkbutton({onClick:function(){
			var yzr_addMedDraw_stored = $("#yzr-addMedDraw-stored").combogrid("getValue");
			$("#tb-medDraw-selectMed").datagrid({
	    		url: 'queryMedByStore_yzr', 
	    		queryParams: {
	    			cangku: yzr_addMedDraw_stored
	    		},
	    		method: 'get'
	    	});			
		}});
			
			
		//搜索
		$('#yzr-selectMed-medDraw-search').searchbox({
		    searcher:function(value,name){
		    	var yzr_addMedDraw_stored = $("#yzr-addMedDraw-stored").combogrid("getValue");
		    	if(value == ''){
		    		$.messager.alert("提示", "请输入查询条件！");
		    	}else{
		    		$("#tb-medDraw-selectMed").datagrid({	    		
			    		url: 'queryMedByName_yzr',
			    		method: 'post', 
			    		queryParams: {
			    			page:1,
			    			rows:13,
			    			medName: value,
			    			cangku: yzr_addMedDraw_stored
			    	}});
		    		$('#yzr-selectMed-medDraw-search').searchbox('setValue', '');
		    	}		    	
		    }
		});
		
		//药品编号，药品名，批号，单位，规格，数量
		var yzr_pandianMed_medDraw = undefined;//药品名
		var yzr_pihao_medDraw = undefined;//批号
		var yzr_storeNum_medDraw = undefined;//库存数量
		var yzr_unit_medDraw = undefined; //单位
		var yzr_medId_medDraw = undefined;//药品id
		var yzr_guige_medDraw = undefined;//规格
		var yzr_price_medDraw = undefined;//单价
		//var yzr_price_medDraw = undefined;//库存数量
		//确定药品
		$("#yzr-ok-btn-medDraw-selectMed").linkbutton({onClick: function(){
			var rows = $("#tb-medDraw-selectMed").datagrid("getSelections");
			if(rows.length == 1){
				 yzr_pandianMed_medDraw = rows[0].medStockMedName;
				 yzr_pihao_medDraw = rows[0].medStockBatchnumber;
				 yzr_storeNum_medDraw = rows[0].medStockNumber;
				 yzr_unit_medDraw = rows[0].medStockUnit;
				 yzr_medId_medDraw = rows[0].medStockMedId;
				 yzr_guige_medDraw = rows[0].medStockGuige;
				 yzr_price_medDraw = rows[0].medStockPrice;
				 
				$("#yzr-addMedDraw-medName").textbox("setValue",yzr_pandianMed_medDraw);
				$("#yzr-selectMed-medDraw-window").window("close");
			}else{
				$.messager.alert("提示", "您还没有选择记录！");
			}
		}});
		
		
		//添加数据到datagrid
		$("#yzr-addMedDraw-addbtn").linkbutton({onClick: function(){
			
			//验证表单是否完善
			if($('#yzr_addMedDraw_form').form("validate")){
				var yzr_tiling = $("#yzr-addMedDraw-number").numberbox("getValue");
				if(eval(yzr_tiling) <= eval(yzr_storeNum_medDraw) && eval(yzr_tiling)>0){
					//添加行
					$('#yzr-medDraw-med-dg').datagrid('appendRow',{
						medDrawDetMedId: yzr_medId_medDraw,
						medDrawDetMedName: yzr_pandianMed_medDraw,
						medDrawDetBatchnumber: yzr_pihao_medDraw,
						medDrawDetGuige: yzr_guige_medDraw,
						medDrawDetUnit:yzr_unit_medDraw,
						medDrawDetNumber: yzr_tiling,
						medDrawDetPrice: yzr_price_medDraw,
						kucunNumber: yzr_storeNum_medDraw
					});
					//清除部分数据
					yzr_pandianMed_medDraw = undefined;//药品名
					yzr_pihao_medDraw = undefined;//批号
					yzr_storeNum_medDraw = undefined;//库存数量
					yzr_unit_medDraw = undefined; //单位
					yzr_medId_medDraw = undefined;//药品id
					yzr_guige_medDraw = undefined;//规格
					yzr_price_medDraw = undefined;//单价

					$("#yzr-addMedDraw-medName").textbox("clear");			
					$("#yzr-addMedDraw-number").numberbox("clear");
				}else{
					$.messager.alert("提示", "提领数量不能大于库存数量！");
				}				
				
			}else{
				$.messager.alert("提示", "请完善信息！");
			}		
		}});
		
		//删除行
		$("#yzr-addMedDraw-cancelbtn").linkbutton({onClick: function(){
			var rows = $("#yzr-medDraw-med-dg").datagrid("getSelections");			
			var yzr_index =$('#yzr-medDraw-med-dg').datagrid('getRowIndex', rows[0]);
			$('#yzr-medDraw-med-dg').datagrid('deleteRow',yzr_index);
		}});
		
		
		//提交数据到数据库
		$("#yzr-medDraw-med-tijiao").linkbutton({onClick: function(){
				
			var rows = $("#yzr-medDraw-med-dg").datagrid("getRows");
			console.log(JSON.stringify(rows));
			
			
			//提交的数据：制定人、审批人、被提领仓库、提领到药房
			var yzr_medDraw_zdr = $("#yzr-addMedDraw-zdr").combogrid("getValue");
			var yzr_medDraw_spr = $("#yzr-addMedDraw-spr").combogrid("getValue");			
			var yzr_medDraw_stored = $("#yzr-addMedDraw-stored").combogrid("getValue");
			var yzr_medDraw_pharmacy = $("#yzr-addMedDraw-pharmacy").combogrid("getValue");
	
			$("<form id='yzr_addMedDraw_form_1' method='post'>").appendTo($("body"));
				
			//medDrawDetMedId,medDrawDetMedName,medDrawDetBatchnumber,medDrawDetGuige,medDrawDetUnit,medDrawDetNumber
			for(var i = 0; i < rows.length; i ++){
				generateHiddenYzr_medDraw(rows[i], "medDrawDetMedId", i);
				generateHiddenYzr_medDraw(rows[i], "medDrawDetMedName", i);
				generateHiddenYzr_medDraw(rows[i], "medDrawDetBatchnumber", i);
				generateHiddenYzr_medDraw(rows[i], "medDrawDetGuige", i);
				generateHiddenYzr_medDraw(rows[i], "medDrawDetUnit", i);
				generateHiddenYzr_medDraw(rows[i], "medDrawDetNumber", i);
				generateHiddenYzr_medDraw(rows[i], "medDrawDetPrice", i);
			}
		
			
			$('#yzr_addMedDraw_form_1').form('submit', {				
				url: 'addMedDrawYzr',
				queryParams: {
					zdr: yzr_medDraw_zdr,
					spr: yzr_medDraw_spr,
					stored: yzr_medDraw_stored,
					pharmacy: yzr_medDraw_pharmacy
	    		}, 
				success: function(v){
					$.messager.alert('提示', "提交成功");
					$(":hidden[x='y']").remove();			
					$('#yzr_addMedDraw_form').form("clear");
					$('#yzr-medDraw-med-dg').datagrid('loadData', { total: 0, rows: [] }); 
					$('#tb-medDraw').datagrid("reload"); 
					
				}
			});
			
		}});

		//name=medPurchDets[0] .属性名称
		//value = row[属性名称]
		//创建隐式表单域来保存明细
		function generateHiddenYzr_medDraw(row, name, i){
			var ff_plan = $('#yzr_addMedDraw_form_1');
			//type='hidden'
			$("<input  x='y'>")
				.attr("name", "medDrawList["+i+"]."+name)
				.val(row[name])
				.appendTo(ff_plan);
		}
		
		
		//查看详情
		$("#yzr-medDraw-more").linkbutton({onClick: function(){
			var rows = $("#tb-medDraw").datagrid("getSelections");
			if(rows.length == 1){
				
				$('#yzr-medDraw-det-window').window({'title': "查看提领单详情"});
				$('#yzr-medDraw-det-window').window("open");
				$('#yzr-medDraw-det-print-hidden').css("display","none");
				$('#yzr-medDraw-det-shenpi-hidden').css("display","none");
				$('#yzr-medDraw-det-cancel-hidden').show();
				var medDrawId = rows[0].medDrawId;
				
				$.getJSON("queryDrawByIdYzr", {"medDrawId": medDrawId}, function(data){
					/* medDrawId,medDrawAutdit,medDrawAutditState,medDrawAutditTime,medDrawDrawPerson,medDrawDrawState,medDrawDrawTime,
					medDrawPharmacyId,medDrawPickPerson,medDrawStoreId */
					$("#yzr-medDraw-det-tlh").linkbutton({text: data.medDrawId});//提领号
					$("#yzr-medDraw-det-tlck").linkbutton({text: data.storeName});//提领仓库
					$("#yzr-medDraw-det-tlyf").linkbutton({text: data.pharmacyName});//提领药房
					$("#yzr-medDraw-det-zdr").linkbutton({text: data.staffNameZd});//制定人
					$("#yzr-medDraw-det-spr").linkbutton({text: data.staffNameSp});//审批人
					$("#yzr-medDraw-det-tlr").linkbutton({text: data.staffNameTl});//提领人
					$("#yzr-medDraw-det-tlsj").linkbutton({text: data.medDrawDrawTime});//提领时间
					$("#yzr-medDraw-det-spzt").linkbutton({text: data.medDrawAutditState});//审批状态
					$("#yzr-medDraw-det-tlzt").linkbutton({text: data.medDrawDrawState});//提领状态
					$("#yzr-medDraw-det-spsj").linkbutton({text: data.medDrawAutditTime});//审批时间
					
					if(data.medDrawAutditState=='待审核' || data.medDrawAutditState=='未通过'){
						$("#yzr-medDraw-det-spzt").css({'color': 'red'});
					}

					if(data.medDrawDrawState=='未提领'){
						$("#yzr-medDraw-det-tlzt").css({'color': 'red'});
					}
				});	
				
				
				 //根据id查看提领药品详情	
				 $("#yzr-medDraw-det-dg").datagrid({
					url:'queryDrawDetByIdYzr',
					width: '100%',
					queryParams:{
						page:1, 
		    			rows:10,
		    			medDrawId: medDrawId
					}
				});
				
			}else{
				$.messager.alert("提示", "请选择一条记录!");
			}
		}});
		
		//打印计划
		$("#yzr-medDraw-print").linkbutton({onClick: function(){
			var rows = $("#tb-medDraw").datagrid("getSelections");
			if(rows.length == 1){
				
				$('#yzr-medDraw-det-window').window({'title': "打印提领单"});
				$('#yzr-medDraw-det-window').window("open");
				$('#yzr-medDraw-det-print-hidden').show();
				$('#yzr-medDraw-det-shenpi-hidden').css("display","none");
				$('#yzr-medDraw-det-cancel-hidden').show();
				
				var medDrawId = rows[0].medDrawId;
				
				$.getJSON("queryDrawByIdYzr", {"medDrawId": medDrawId}, function(data){
					/* medDrawId,medDrawAutdit,medDrawAutditState,medDrawAutditTime,medDrawDrawPerson,medDrawDrawState,medDrawDrawTime,
					medDrawPharmacyId,medDrawPickPerson,medDrawStoreId */
					$("#yzr-medDraw-det-tlh").linkbutton({text: data.medDrawId});//提领号
					$("#yzr-medDraw-det-tlck").linkbutton({text: data.storeName});//提领仓库
					$("#yzr-medDraw-det-tlyf").linkbutton({text: data.pharmacyName});//提领药房
					$("#yzr-medDraw-det-zdr").linkbutton({text: data.staffNameZd});//制定人
					$("#yzr-medDraw-det-spr").linkbutton({text: data.staffNameSp});//审批人
					$("#yzr-medDraw-det-tlr").linkbutton({text: data.staffNameTl});//提领人
					$("#yzr-medDraw-det-tlsj").linkbutton({text: data.medDrawDrawTime});//提领时间
					$("#yzr-medDraw-det-spzt").linkbutton({text: data.medDrawAutditState});//审批状态
					$("#yzr-medDraw-det-tlzt").linkbutton({text: data.medDrawDrawState});//提领状态
					$("#yzr-medDraw-det-spsj").linkbutton({text: data.medDrawAutditTime});//审批时间
					
					if(data.medDrawAutditState=='待审核' || data.medDrawAutditState=='未通过'){
						$("#yzr-medDraw-det-spzt").css({'color': 'red'});
					}

					if(data.medDrawDrawState=='未提领'){
						$("#yzr-medDraw-det-tlzt").css({'color': 'red'});
					}
				});	
				
				
				 //根据id查看提领药品详情	
				 $("#yzr-medDraw-det-dg").datagrid({
					url:'queryDrawDetByIdYzr',
					width: '100%',
					queryParams:{
						page:1, 
		    			rows:10,
		    			medDrawId: medDrawId
					}
				});
				
			}else{
				$.messager.alert("提示", "请选择一条记录!");
			}
		}});
		
		//点击按钮打印
		$("#yzr-medDraw-det-print").linkbutton({onClick: function(){
				/* var printpage = $('#yzr-medDraw-detPrint-printArea').html();
				printdivDrawYzr(printpage); */
				$("#yzr_medDraw-det_form").jqprint();
			}
		});
		//打印
		/* function printdivDrawYzr(printpage){ 
			//获得当前页面body里面的内容
			var bodyHtml = document.body.innerHTML;
			//把打印的内容填充
			document.body.innerHTML = printpage; 
			//打印
			window.print(); 
			//把body的内容还原
			document.body.innerHTML = bodyHtml; 
			return true;

		} */
		
		//刷新
		$("#yzr-medDraw-reload").linkbutton({onClick:function(){
			$("#tb-medDraw").datagrid({
	    		url: 'queryAllDrawYzr', 
	    		method: 'get'
	    	});			
		}});
		
		//各种条件查询
		$('#yzr-medDraw-input').searchbox({
		    searcher:function(value,name){
		    	if(value == ''){
		    		$.messager.alert("提示", "请输入查询条件！");
		    	}else{
		    		$("#tb-medDraw").datagrid({	    		
			    		url:'queryDrawByIfYzr',
			    		method: 'post', 
			    		queryParams: {
			    			value: value,
			    			name: name
			    	}});
			    	$('#yzr-medDraw-input').searchbox('setValue', '');
		    	}		    	
		    }		    
		}); 
		
		//时间段查询
		$("#yzr-ok-search-medDraw").linkbutton({onClick:function(){
			
			var start = $("#yzr-medDraw-startDate").datebox("getValue");
			var end = $("#yzr-medDraw-endDate").datebox("getValue");
			
			if(start == '' || end == ''){
				$.messager.alert("提示", "请选择日期！");
			}else{
				$("#tb-medDraw").datagrid({
		    		url: 'queryByDrawDateYzr', 
		    		method: 'post',
		    		queryParams: {
		    			startDate: start,
		    			endDate: end
		    	}});
				$('#yzr-medDraw-startDate').datebox('setValue', '');
				$('#yzr-medDraw-endDate').datebox('setValue', '');
			}			
		}});
	});
</script>



<script type="text/javascript">

	$(function(){
		//获取当前登录用户的id
		var  shenpi_draw_staffId = $("#tontyiStaffId").html();
		var shenpi_draw_state  = undefined;
		
		
		//查找出需要当前用户审批的提领单
		$("#tb-medDraw-sp").datagrid({
			url: "queryDrawByStaffIdYzr",
			queryParams:{
				page:1, 
    			rows:10,
				staffId: shenpi_draw_staffId
			}
		});
		
		//刷新提领单
		$("#yzr-medDraw-sp-reload").linkbutton({onClick: function(){
			$("#tb-medDraw-sp").datagrid({
				url: "queryDrawByStaffIdYzr",
				queryParams:{
					page:1, 
	    			rows:10,
					staffId: shenpi_draw_staffId
				}
			});
		}});
		
		//审批提领单
		$("#yzr-medDraw-sp-submit").linkbutton({onClick: function(){
			var rows = $("#tb-medDraw-sp").datagrid("getSelections");
			if(rows.length == 1){				
				$('#yzr-medDraw-det-window').window({'title': "审批提领单"});
				$('#yzr-medDraw-det-window').window("open");
				
				$('#yzr-medDraw-det-shenpi-hidden').show();
				$('#yzr-medDraw-det-print-hidden').css("display","none");
				$('#yzr-medDraw-det-cancel-hidden').css("display","none");
				var medDrawId = rows[0].medDrawId;
				
				$.getJSON("queryDrawByIdYzr", {"medDrawId": medDrawId}, function(data){
					$("#yzr-medDraw-det-tlh").linkbutton({text: data.medDrawId});//提领号
					$("#yzr-medDraw-det-tlck").linkbutton({text: data.storeName});//提领仓库
					$("#yzr-medDraw-det-tlyf").linkbutton({text: data.pharmacyName});//提领药房
					$("#yzr-medDraw-det-zdr").linkbutton({text: data.staffNameZd});//制定人
					$("#yzr-medDraw-det-spr").linkbutton({text: data.staffNameSp});//审批人
					$("#yzr-medDraw-det-tlr").linkbutton({text: data.staffNameTl});//提领人
					$("#yzr-medDraw-det-tlsj").linkbutton({text: data.medDrawDrawTime});//提领时间
					$("#yzr-medDraw-det-spzt").linkbutton({text: data.medDrawAutditState});//审批状态
					$("#yzr-medDraw-det-tlzt").linkbutton({text: data.medDrawDrawState});//提领状态
					$("#yzr-medDraw-det-spsj").linkbutton({text: data.medDrawAutditTime});//审批时间
					
					if(data.medDrawAutditState=='待审核' || data.medDrawAutditState=='未通过'){
						$("#yzr-medDraw-det-spzt").css({'color': 'red'});
					}

					if(data.medDrawDrawState=='未提领'){
						$("#yzr-medDraw-det-tlzt").css({'color': 'red'});
					}
				});	
				
				
				 //根据id查看提领药品详情	
				 $("#yzr-medDraw-det-dg").datagrid({
					url:'queryDrawDetByIdYzr',
					width: '100%',
					queryParams:{
						page:1, 
		    			rows:10,
		    			medDrawId: medDrawId
					}
				});
				
			}else{
				$.messager.alert("提示", "请选择一条记录!");
			}
		}});
		

		//通过
		$("#yzr-draw-sp-pass").linkbutton({onClick: function(){
			
			shenpi_draw_state = '已通过';

           	var rows = $("#tb-medDraw-sp").datagrid("getSelections");
           	var drawId_sp = rows[0].medDrawId;
           	$("#yzr_medDraw-det_form").form("submit", {
       			url: 'shenpiDrawYzr',
       			queryParams:{
       				shenpiState: shenpi_draw_state,
       				drawId: drawId_sp
				},
       			success: function(v){
       				$.messager.alert('提示', "审批成功");
       				$('#yzr-medDraw-det-window').window("close");
       				$("#tb-medDraw-sp").datagrid("reload");
       			}
       		});
			
		}});
		
		
		
		//不通过
		$("#yzr-draw-sp-fail").linkbutton({onClick: function(){
			
			shenpi_draw_state = '未通过';

           	var rows = $("#tb-medDraw-sp").datagrid("getSelections");
           	var drawId_sp = rows[0].medDrawId;
           	$("#yzr_medDraw-det_form").form("submit", {
       			url: 'shenpiDrawYzr',
       			queryParams:{
       				shenpiState: shenpi_draw_state,
       				drawId: drawId_sp
				},
       			success: function(v){
       				$.messager.alert('提示', "审批成功");
       				$('#yzr-medDraw-det-window').window("close");
       				$("#tb-medDraw-sp").datagrid("reload");
       			}
       		});
			
		}});
		
		
	});
</script>







<!-- 
	提领号，制定人，审核人，审核时间，提领人，提领时间，被提领仓库，提领药房，审核状态，是否提领
	medDrawId,medDrawAutdit,medDrawAutditState,medDrawAutditTime,medDrawDrawPerson,medDrawDrawState,medDrawDrawTime,medDrawPharmacyId,medDrawPickPerson,medDrawStoreId
	
	提领详情单号，提领单号，药品编号，药品名称，批号，规格，单价，数量，金额，生产日期，保质期
	medDrawDetId,drawDetDrawId,medDrawDetBaozhiqi,medDrawDetBatchnumber,medDrawDetGuige,medDrawDetMedId,medDrawDetMedName,medDrawDetMoney,medDrawDetNumber,medDrawDetPrice,medDrawDetShengchanriqi	
-->
	<form id="yzrr-medDraw-up-from" method="post" style="width:100%;padding:10px;background:#ECF3FF;">
		 <!-- 工具栏 -->
	    <div id="yzr_mdDraw_gj">
	    	<input id="yzr-medDraw-input" class="easyui-searchbox" data-options="menu: '#yzr_medDraw_search', width: 250, prompt: '请输入关键字'"/>    	
	    	<input id="yzr-medDraw-startDate" class="easyui-datebox" data-options="label:'提领日期',labelAlign:'right', width: 200" /> -
	    	<input id="yzr-medDraw-endDate" class="easyui-datebox" data-options="width: 110"/>
	    	<a id="yzr-ok-search-medDraw" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'">查询</a>
	    </div>
	    	    
	    <!-- 搜索框 -->
	    <div id="yzr_medDraw_search" style="width:120px">
	    	<div data-options="name:'drawId'">提领号</div>
		    <div data-options="name:'zdr'">制定人</div>
		    <div data-options="name:'spr'">审批人</div>
		    <div data-options="name:'tlr'">提领人</div>
		    <div data-options="name:'spzt'">审批状态</div>
		    <div data-options="name:'tlzt'">提领状态</div>
		</div>	
	
	</form>
	
	
	
	
	<div id="yzr-medDraw-tabs" class="easyui-tabs" style="width:100%;margin-top:10px;" data-options="fit:true,plain:true,narrow:true">    
	    
	    <!-- tab1-->
	    <div title="查看提领单" style="padding:0px;display:none;" data-options="iconCls:'icon-search'">
			<table id="tb-medDraw" class="easyui-datagrid"  style="height:400px;"
				data-options="
					url: 'queryAllDrawYzr', 
					singleSelect: true,
					fitColumns: true,
					pagination: true,
					pageSize: 10,
					pageList: [10, 20, 30, 40],
					rownumbers: true,
					toolbar: '#yzr-medDraw-tb',
					border: false
					">
				<thead>
					<tr>					
						<th data-options="field:'XXX',width:'1%',checkbox:true,align:'center'"></th>	
						<th data-options="field:'medDrawId',width:'15%',align:'center'">提领号</th>				
						<th data-options="field:'staffNameZd',width:'8%',align:'center'">制定人</th>
						<th data-options="field:'staffNameSp',width:'8%',align:'center'">审核人</th>
						<th data-options="field:'medDrawAutditTime',width:'9%',align:'center'">审核时间</th>				
						<th data-options="field:'staffNameTl',width:'9%',align:'center'">提领人</th>			
						<th data-options="field:'medDrawDrawTime',width:'10%',align:'center'">提领时间</th>				
						<th data-options="field:'storeName',width:'12%',align:'center'">被提领仓库</th>
						<th data-options="field:'pharmacyName',width:'12%',align:'center'">提领药房</th>
						<th data-options="field:'medDrawAutditState',width:'8%',align:'center'">审核状态</th>
						<th data-options="field:'medDrawDrawState',width:'8%',align:'center'">提领状态</th>
					</tr>
				</thead>
			</table>
			
			<!-- 工具栏 -->
			<div id="yzr-medDraw-tb">				
				<a id="yzr-medDraw-more" class="easyui-linkbutton" data-options="iconCls:'icon-more',plain:true">查看详情</a>			
				<a id="yzr-medDraw-print" class="easyui-linkbutton" data-options="iconCls:'icon-print',plain:true">打印</a>				
				<a id="yzr-medDraw-reload" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true">刷新</a>				
			</div>			
	    </div>
	    
	    
	    
	    <!-- tab2 -->
	    <div title="添加提领单" data-options="iconCls:'icon-add'" style="overflow:auto;display:none;">
			
			<form id="yzr_addMedDraw_form" method="post" style="padding:10px 20px 10px 10px;background:#ECF3FF;">	
				<table style="width:100%;" >
					<tr>
						<td style="width:42%;">
							<select class="easyui-combogrid" id="yzr-addMedDraw-zdr"
								data-options="
									label: '制定人',
									width: '95%',
									readonly:true,
									labelAlign:'right',
									panelWidth: '290',
									panelHeight: 'auto',
									required:true,
									url: 'queryAllStaff',
									pagination: true,
									pageSize: 8,
									pageList: [8, 16, 24, 32],
									idField: 'staffNo',
									textField: 'staffName',
									columns: [[
										{field:'staffName',title:'姓名',width:100},
										{field:'departmentName',title:'部门',width:100},
										{field:'postName',title:'职务',width:85}
									]]
							"></select>
						</td>
						<td style="width:42%;">
							<select class="easyui-combogrid" id="yzr-addMedDraw-spr"
								data-options="
									label: '审批人',
									width: '95%',
									labelAlign:'right',
									panelWidth: '290',
									panelHeight: 'auto',
									required:true,
									url: 'queryAllStaff',
									pagination: true,
									pageSize: 8,
									pageList: [8, 16, 24, 32],
									idField: 'staffNo',
									textField: 'staffName',
									columns: [[
										{field:'staffName',title:'姓名',width:100},
										{field:'departmentName',title:'部门',width:100},
										{field:'postName',title:'职务',width:85}
									]]
							"></select>
						</td>
						<td style="width:16%;"></td>
					</tr>
					
					<tr>
						<td>
							<select class="easyui-combogrid" id="yzr-addMedDraw-stored"
								data-options="
									label: '被提领仓库',
									labelAlign:'right',
									required:true,
									width: '95%',
									panelWidth: '290',
									panelHeight: 'auto',
									url: 'queryAllStorehouse',
									pagination: true,
									pageSize: 8,
									pageList: [8, 16, 24, 32],
									idField: 'storeId',
									textField: 'storeName',
									columns: [[				
										{field:'storeName',title:'仓库名',width:100},
										{field:'storeKind',title:'类型',width:85},
										{field:'storeAddress',title:'地址',width:100}
									]]
							"></select>
						</td>
						<td>
							<select class="easyui-combogrid" id="yzr-addMedDraw-pharmacy"
								data-options="
									label: '提领到药房',
									labelAlign:'right',
									required:true,
									width: '95%',
									panelWidth: '290',
									panelHeight: 'auto',
									url: 'queryAllPharmacy',
									pagination: true,
									pageSize: 8,
									pageList: [8, 16, 24, 32],
									idField: 'pharmacyId',
									textField: 'pharmacyName',
									columns: [[				
										{field:'pharmacyName',title:'药房名',width:100},
										{field:'staffName',title:'负责人',width:85},
										{field:'pharmacyAddress',title:'地址',width:100}
									]]
							"></select>
						</td>
					</tr>
					<tr>
						<td>
							<input id="yzr-addMedDraw-medName" class="easyui-textbox" data-options="required:true,width: '75%',labelAlign:'right',label:'药品'"/>
							<a id="yzr-addMedDraw-med-btn" href="#" class="easyui-linkbutton" data-options="width: '19%',iconCls:'icon-search'">查找</a>
						</td>
						<td>
							<input id="yzr-addMedDraw-number" class="easyui-numberbox" data-options="required:true,width: '95%',labelAlign:'right',label:'提领数量'"/>
						</td>
						<td>
							<a id="yzr-addMedDraw-addbtn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'">添加</a>
							<a id="yzr-addMedDraw-cancelbtn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'">删除</a>
						</td>
					</tr>					
				</table>
			</form>

			
			<!-- 提领药品 -->
			<div style="margin: 5px;">
				<div id="yzr-medDraw-med-tabs" class="easyui-tabs" style="width:100%; margin-top:0px;" data-options="plain:true,narrow:true">
					<div title="提领药品" style="padding:10px;">
							<table id="yzr-medDraw-med-dg" class="easyui-datagrid" 
									data-options="
										iconCls: 'icon-edit',
										singleSelect:true,	
										toolbar: '#yzr-medDraw-med-tb',							
										width: '100%'
										">
									<thead>
										<tr><!--药品编号，药品名称，批号，规格，单位，数量
										medDrawDetMedId,medDrawDetMedName,medDrawDetBatchnumber,medDrawDetGuige,medDrawDetUnit,medDrawDetNumber
										-->
											<th data-options="field:'medDrawDetMedId',width:'20%',align:'center'">药品编号</th>			
											<th data-options="field:'medDrawDetMedName',width:'20%',align:'center'">药品名称</th>
											<th data-options="field:'medDrawDetBatchnumber',width:'20%',align:'center'">批号</th>
											<th data-options="field:'medDrawDetGuige',width:'11%',align:'center'">规格</th>
											<th data-options="field:'medDrawDetUnit',width:'8%',align:'center'">单位</th>
											<th data-options="field:'kucunNumber',width:'11%',align:'center'">库存数量</th>
											<th data-options="field:'medDrawDetNumber',width:'11%',align:'center'">提领数量</th>
											<th data-options="field:'medDrawDetPrice',width:'13%',align:'center',hidden:true">单价</th>
										</tr>
									</thead>
							</table>
							
							<div id="yzr-medDraw-med-tb">								
								<a id="yzr-medDraw-med-tijiao" href="#" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-ok'">提交</a>			
							</div>
					 </div>							
				</div>						
			</div>		
				
		</div>
	    
	    
   
	    
	    <!-- tab3 -->
	    <div title="审批提领单" data-options="iconCls:'icon-shenpi'" style="padding:0px;display:none;" >
			
			<table id="tb-medDraw-sp" class="easyui-datagrid"  style="height:400px;"
				data-options="
					singleSelect: true,
					fitColumns:true,
					pagination: true,
					pageSize: 10,
					pageList: [10, 20, 30, 40],
					rownumbers: true,
					toolbar: '#yzr-medDraw-sp-tb',
					border:false
					">
				<thead>
					<tr>					
						<th data-options="field:'XXX',width:'1%',checkbox:true,align:'center'"></th>	
						<th data-options="field:'medDrawId',width:'15%',align:'center'">提领号</th>				
						<th data-options="field:'staffNameZd',width:'8%',align:'center'">制定人</th>
						<th data-options="field:'staffNameSp',width:'8%',align:'center'">审核人</th>
						<th data-options="field:'medDrawAutditTime',width:'9%',align:'center'">审核时间</th>				
						<th data-options="field:'staffNameTl',width:'9%',align:'center'">提领人</th>			
						<th data-options="field:'medDrawDrawTime',width:'10%',align:'center'">提领时间</th>				
						<th data-options="field:'storeName',width:'12%',align:'center'">被提领仓库</th>
						<th data-options="field:'pharmacyName',width:'12%',align:'center'">提领药房</th>
						<th data-options="field:'medDrawAutditState',width:'8%',align:'center'">审核状态</th>
						<th data-options="field:'medDrawDrawState',width:'8%',align:'center'">提领状态</th>
					</tr>
				</thead>
			
			</table>
			
			<!-- 工具栏 -->
			<div id="yzr-medDraw-sp-tb">				
				<a id="yzr-medDraw-sp-submit" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">审批计划</a>
				<a id="yzr-medDraw-sp-reload" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true">刷新</a>								
			</div>
	    </div>
	    
	    
	</div>
	
	
	
	
	
	
	
	
	
	
	
	<!--查看详情窗口-打印 -->
	<div id="yzr-medDraw-det-window" class="easyui-window" title="打印提领详情" data-options="collapsible:false,minimizable:false,maximizable:false,modal:true,iconCls:'icon-save',closed: true" style="width:70%;height:70%;">		
		<div class="easyui-layout" style="padding:0px;" data-options="fit:true">			
			<div id="yzr-medDraw-detPrint-printArea" data-options="region:'center'" style="padding:5px;border-top:none;border-left:none;border-right:none;">			
				<form id="yzr_medDraw-det_form" method="post">
					<table width="100%">
						<tr>
							<td>提领号:<a id="yzr-medDraw-det-tlh"  class="easyui-linkbutton" data-options="plain:true"></a></td>
							<td>被提领仓库:<a id="yzr-medDraw-det-tlck"  class="easyui-linkbutton" data-options="plain:true"></a></td>
							<td>提领到药房:<a id="yzr-medDraw-det-tlyf"  class="easyui-linkbutton" data-options="plain:true"></a></td>
							<td>制定人:<a id="yzr-medDraw-det-zdr"  class="easyui-linkbutton" data-options="plain:true"></a></td>
							<td>审批人:<a id="yzr-medDraw-det-spr"  class="easyui-linkbutton" data-options="plain:true"></a></td>
						</tr>
						<tr>
							<td>提领人:<a id="yzr-medDraw-det-tlr"     class="easyui-linkbutton" data-options="plain:true"></a></td>
							<td>提领时间:<a id="yzr-medDraw-det-tlsj"  class="easyui-linkbutton" data-options="plain:true"></a></td>
							<td>审批状态:<a id="yzr-medDraw-det-spzt"  class="easyui-linkbutton" data-options="plain:true"></a></td>
							<td>提领状态:<a id="yzr-medDraw-det-tlzt"  class="easyui-linkbutton" data-options="plain:true"></a></td>
							<td>审批时间:<a id="yzr-medDraw-det-spsj"  class="easyui-linkbutton" data-options="plain:true"></a></td>
						</tr>
					</table>
						
					<div style="margin: 5px;">
						<div id="yzr-medDraw-det-tabs" class="easyui-tabs" style="width:100%; margin-top:10px;" 
							data-options="plain:true,narrow:true">
							
							<div title="提领单明细" style="padding:10px;">
								<table id="yzr-medDraw-det-dg" class="easyui-datagrid" 
									data-options="
										iconCls: 'icon-edit',
										singleSelect:true,						
										width: '100%'
										">
									<thead>
										<tr><!--药品编号，药品名称，批号，规格，单位，数量
										medDrawDetMedId,medDrawDetMedName,medDrawDetBatchnumber,medDrawDetGuige,medDrawDetUnit,medDrawDetNumber
										-->
											<th data-options="field:'medDrawDetMedId',width:'20%',align:'center'">药品编号</th>			
											<th data-options="field:'medDrawDetMedName',width:'20%',align:'center'">药品名称</th>
											<th data-options="field:'medDrawDetBatchnumber',width:'20%',align:'center'">批号</th>
											<th data-options="field:'medDrawDetGuige',width:'15%',align:'center'">规格</th>
											<th data-options="field:'medDrawDetUnit',width:'10%',align:'center'">单位</th>
											<th data-options="field:'medDrawDetNumber',width:'15%',align:'center'">提领数量</th>
											<th data-options="field:'medDrawDetPrice',width:'15%',align:'center',hidden:true">单价</th>
										</tr>
									</thead>
							</table>
							</div>							
						</div>						
					</div>
				</form>				
			</div>
					
			<div data-options="region:'south',border:false" style="text-align:right;padding:5px 0 0;">
				
				<div id="yzr-medDraw-det-print-hidden" style="display:inline;">
					<a id="yzr-medDraw-det-print" class="easyui-linkbutton" data-options="iconCls:'icon-print', plain:true">打印</a>
				</div>
				
				<div id="yzr-medDraw-det-cancel-hidden" style="display:inline;">
					<a class="easyui-linkbutton" data-options="iconCls:'icon-cancel', plain:true" href="javascript:$('#yzr-medDraw-det-window').window('close');" onclick="">取消</a>			
				</div>
				
				<div id="yzr-medDraw-det-shenpi-hidden" style="display:inline;">
					<a id="yzr-draw-sp-pass" class="easyui-linkbutton" data-options="iconCls:'icon-ok', plain:true">PASS</a>
					<a id="yzr-draw-sp-fail" class="easyui-linkbutton" data-options="iconCls:'icon-cancel', plain:true">FAIL</a>
				</div>
				
			</div>			
		</div>
	</div>
	
	
	<!-- 选择药品窗口 -->
	<div id="yzr-selectMed-medDraw-window" class="easyui-window" title="选择提领药品" style="width:850px;height:350px;" data-options="closable:true,closed:true,collapsible:false,minimizable:false,maximizable:false">
		<table id="tb-medDraw-selectMed" class="easyui-datagrid"
			data-options="				
				fit:true,
				pagination: true,
				pageSize: 8,
				pageList: [8, 16, 24, 32],
				rownumbers: false,
				toolbar: '#yzr-selectMed-medDraw-tb',
				border:false,
				singleSelect:true
			">
			<thead>
				<tr>	
				<!-- 库存编号，仓库编号，药品编号，药品名，批号，类型（中药，西药），规格，单位，单价，数量，金额	
				//medStockId,medStockBatchnumber,medStockGuige,medStockMedId,medStockMedKind,medStockMedName,medStockMoney,
				//medStockNumber,medStockPrice,medStockStoreId,medStockUnit -->
					<!-- <th data-options="field:'medStockId',width:'15%',align:'center'">库存编号</th> -->
					<th data-options="field:'storeName',width:'18%',align:'center'">仓库</th>
					<th data-options="field:'medStockMedId',width:'18%',align:'center'">药品编号</th>
					<th data-options="field:'medStockMedName',width:'18%',align:'center'">药品名</th>
					<th data-options="field:'medStockMedKind',width:'10%',align:'center'">类型</th>	
					<th data-options="field:'medStockBatchnumber',width:'10%',align:'center'">批号</th>					
					<th data-options="field:'medStockGuige',width:'10%',align:'center'">规格</th>	
					<th data-options="field:'medStockUnit',width:'8%',align:'center'">单位</th>		
					<th data-options="field:'medStockNumber',width:'10%',align:'center'">数量</th>
					<th data-options="field:'medStockPrice',width:'10%',align:'center',hidden:true">单价</th>									
				</tr>
			</thead>
		</table>				    
		    
		<div id="yzr-selectMed-medDraw-tb">		
			<input id="yzr-selectMed-medDraw-search" class="easyui-searchbox" data-options="menu: '#yzr-selectMed-medDraw-pName', width: 220, prompt: '请输入关键字'"/>
			<a id="yzr-selectMed-medDraw-reload" class="easyui-linkbutton" data-options="iconCls:'icon-reload'">刷新</a>
			<a id="yzr-ok-btn-medDraw-selectMed" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" style="margin-left:475px;">确定</a>			
		</div>
		
		<div id="yzr-selectMed-medDraw-pName" style="width:140px">
		    <div data-options="name:'name'">药品名称</div>
		</div>
	</div>	

</body>
</html>